<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								电梯名称：<input type="text" name="elevatorName"/>
							</li>
							<li>
								故障单号：<input type="text" name="faultCode"/>
							</li>
							<li>
								处理状态：
								<select name="disposeState" th:with="type=${@dict.getType('business_handle_status')}">
									<option value="">所有</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('business:elevatorFault:edit')}]];
        var removeFlag = [[${@permission.hasPermi('business:elevatorFault:remove')}]];
		var faultType = [[${@dict.getType('business_fault_type')}]];
		var disposeState = [[${@dict.getType('business_handle_status')}]];
        var prefix = ctx + "business/elevatorFault";

        $(function() {
            var options = {
                url: prefix + "/list?type=1",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "电梯故障",
				sortName: "reportTime",
				sortOrder: "DESC",
				search: false,
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'faultId', 
					title : '故障ID',
					visible: false
				},
				{
					title: "序号",
					formatter: function (value, row, index) {
						return $.table.serialNumber(index);
					}
				},
				{
					field : 'elevatorId', 
					title : '关联电梯ID',
                    visible: false
				},
				{
					field : 'faultCode',
					title : '故障单号'
				},
				{
					field : 'elevatorName', 
					title : '电梯名称'
				},
				{
					field : 'faultType', 
					title : '故障类型',
					formatter: function (value, row, index) {
					return $.table.selectDictLabel(faultType, value);
					}
				},
				{
					field : 'reportTime', 
					title : '上报时间',
					sortable: true
				},
				{
					field : 'faultFloor', 
					title : '故障楼层',
				},
				{
					field : 'disposeState', 
					title : '处理状态',
					formatter: function (value, row, index) {
						return $.table.selectDictLabel(disposeState, value);
					}
				},
				{
					field : 'disposeMan', 
					title : '处理人'
				},
				{
					field : 'disposeDate', 
					title : '处理时间',
					sortable: true
				},
				{
					field : 'repairOrder', 
					title : '维修单号'
				},
		        /*{
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	var name = "电梯："+row.elevatorName+"立即处理";
		            	var url = ctx + "business/elevatorFault/immediatelyHandle/"+row.faultId;
		            	if(row.disposeState == '1' || row.disposeState == '4'){
                            actions.push('/')
						}else{
                            actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="#" onclick="$.modal.open(\'' +name+ '\',\'' +url+ '\',500,400)"><i class="fa fa-edit"></i>立即处理</a> ');
                        }
						return actions.join('');
		            }
		        }*/]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>